<?php

namespace App\Http\Requests\API;

use App\Models\StaffInfo;
use InfyOm\Generator\Request\APIRequest;

class CreateStaffInfoAPIRequest extends APIRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'oid' => 'required',
            'name' => 'required',
            'idno' => 'bail|required|unique:staff_info',
            'mobile' => 'bail|required|unique:staff_info',
            'vpl_number' => 'bail|required|unique:staff_info',
        ];
    }


    public function messages(){
        return [
            'oid.required'  => '组织ID不能为空！',
            'name.required' => '员工姓名不能为空！',
            'idno.required' => '身份证号码不能为空！',
            'idno.unique'   => '身份证号码已存在！',
            'mobile.required' => '手机号不能为空！',
            'mobile.unique'   => '手机号已存在！',
            'vpl_number.required' => '车牌号不能为空！',
            'vpl_number.unique'   => '车牌号已存在！',
        ];
    }

}
